package com.hua.utils;

import com.hua.pojo.securityUser.SecurityUser;
import org.joda.time.DateTime;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.UUID;

/**
 * @author ONE-X
 * @date 2020/11/09
 */
public class HuaUtil {
	public static String getUuid(){
		return UUID.randomUUID().toString().replaceAll("-","");
	}
	public static Date DATE = DateTime.now().toDate();

	// 获取当前用户
	public static String returnAuthentication(){
		SecurityUser securityUser = (SecurityUser)SecurityContextHolder.getContext().getAuthentication().getPrincipal();
		String id = securityUser.getKsUser();
		return id;
	}
}
